package cts;

import java.awt.Color;
import java.util.Random;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingWorker;

public class linerunner extends SwingWorker<Boolean,Boolean>{
	
	public JPanel threadPanel;
	
	@Override
	protected Boolean doInBackground() throws Exception {
		Random rd=new Random(System.currentTimeMillis());	
		for(int i=0;i<800;i++)
		{
			int r,g,b;
			r=rd.nextInt(255);
			g=rd.nextInt(255);
			b=rd.nextInt(255);
			JLabel label=new JLabel();
			label.setToolTipText("Red :"+r+" Green: "+g+" Blue: "+b);
			label.setBackground(new Color(r, g,b));
			label.setBounds(i, 5, 1, 40);
			label.setOpaque(true);
			threadPanel.add(label);
			threadPanel.repaint();
			System.out.println(i);
			Thread.sleep(100);
		}
		return true;
	}
	
	

}
